<template>
  <div class="ibox">
    <div class="ibox-title">
      <span class="icon-title" :style="color">{{subtitle}}</span>
      <h5>{{title}}</h5>
    </div>
    <div class="ibox-content">
      <h2>{{content}}</h2>
      <div class="sub-icon">
        <slot name="icon"></slot>
      </div>
      <small>{{subContent}}</small>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: '标题'
    },
    color: {type: String},
    subtitle: {type: String},
    content: {type: [String, Number]},
    subContent: {type: String}
  }
}
</script>

<style lang="less" scoped>
  @import "../../common/less/variable";
  .ibox{
    position: relative;
    clear: both;
    padding: 0;
    &:hover{
      box-shadow: 0 1px 6px rgba(0,0,0,.2);
      border-color: #eee;
    }
    .ibox-title {
      min-height: 48px;
      padding: 14px 15px 7px;
      margin-bottom: 0;
      color: inherit;
      border-width: 4px 0 0;
      border-style: solid solid none;
      border-image: none;
      border-color: #e7eaec;
      background: #fff;
      .icon-title{
        float: right;
        display: inline;
        line-height: 1;
        text-align: center;
        white-space: normal;
        vertical-align: middle;
        border-radius: .25em;
        margin-left: 4px;
        background-color: #1c84c6;
        color: #fff;
        font-size: 10px;
        font-weight: 600;
        padding: 3px 8px;
        text-shadow: none;
      }
      h5 {
        display: inline-block;
        font-size: 14px;
        margin: 0 0 7px;
        padding: 0;
        text-overflow: ellipsis;
        float: left;
      }
    }
    .ibox-content{
      clear: both;
      padding: 15px 20px 20px;
      border-color: #e7eaec;
      border-image: none;
      border-style: solid solid none;
      border-width: 1px 0;
      color: inherit;
      background-color: #fff;
      h2 {
        margin: 0;
        font-size: @font-size-large-xx;
        font-weight: 100;
      }
      .sub-icon{
        float: right;
        font-weight: 600;
      }
      small{
        font-size: 85%;
      }
    }
  }
</style>
